﻿using MoreEvent.Common.Players;
using MoreEvent.Common.Systems;
using Terraria;
using Terraria.ModLoader;

namespace MoreEvent.Content.Buffs
{
    public class Heatstroke : ModBuff
    {
        public override void SetStaticDefaults()
        {
            Main.debuff[Type] = true;
            Main.pvpBuff[Type] = true;
            Main.buffNoTimeDisplay[Type] = true;
        }
        public override void Update(Player player, ref int buffIndex)
        {
            EventPlayer modPlayer = player.GetModPlayer<EventPlayer>();
            modPlayer.heatEffect = true;
            if (!EventSystem.ActiveEvents.Contains(5))
            {
                player.buffTime[buffIndex] = 0;
                modPlayer.heatEffect = false;
            }
            else if (player.ZoneSnow || player.wet)
            {
                player.buffTime[buffIndex] = 0;
                modPlayer.heatEffect = false;
            }
            if (player.ZoneDesert)
            {
                player.lifeRegen -= 4;
            }
        }
    }
}
